#include "Fish.h"
#include "FishImpl.h"
#include "Aquarium.h"

Fish::Fish(FishImpl& fishImpl) : 
	fishImpl(&fishImpl)
{
	funcMap.insert(pair<const string, Fish::updateHandle> ("feed", &Fish::eat)); 
	funcMap.insert(pair<const string, Fish::updateHandle> ("pausePlay", &Fish::pausePlay));
	funcMap.insert(pair<const string, Fish::updateHandle> ("debug", &Fish::debugHandle));
}

void Fish::eat() {fishImpl->eat();};
void Fish::debug() const {fishImpl->debug();};
void Fish::pausePlay() {fishImpl->pausePlay();};
const string& Fish::getTypeStr() const {return fishImpl->getTypeStr();};

void Fish::update(Subject *chngSub, const string& command) {
	map<const string, Fish::updateHandle>::iterator iter = this->funcMap.find(command);
	if (iter != funcMap.end()) {
		Fish::updateHandle func = iter->second;
		(this->*func)();
	}
};

Fish::~Fish() {};